package com.gexin.controller.xapp.acitivity;

import com.gexin.common.model.ApiResponse;
import com.gexin.core.interceptor.XAppSafeInterceptor;
import com.gexin.core.web.AppController;
import com.gexin.service.memberAcitivty.BillOfShopService;
import com.gexin.service.memberAcitivty.MemberActivityService;
import com.gexin.service.memberAcitivty.MemberInfoService;
import com.jfinal.aop.Before;
import com.jfinal.ext.route.ControllerBind;
import com.jfinal.plugin.activerecord.tx.Tx;

import java.math.BigDecimal;

@Before(XAppSafeInterceptor.class)//统一错误拦截
@ControllerBind(controllerKey = "/xapp/billShopController")
public class BillShopController extends AppController {

    private BillOfShopService billOfShopService  = new BillOfShopService();


    /**
     * 提货券赠送
     */
    @Before(Tx.class)
    public ApiResponse presentBillOfPre() throws Exception {
        String presentId = getPara("presentId");
        int billOfPre = getParaToInt("billOfPre");
        String authUser = getAuthUser().getId()+"";
        ApiResponse apiResponse = billOfShopService.presentBillOfPre(authUser, presentId, BigDecimal.valueOf(billOfPre));
        renderJson(apiResponse);
        return apiResponse;
    }



///**
//     * 获得积分所有信息
//     * @return
//     */
//    public ApiResponse getBillOfShop(){
//        WeixinUser authUser = getAuthUser();
//        IntegralService inviterService = new IntegralService();
//        return memberActivityService.getBillOfShop(authUser.getId()+"");
//    }*/
//


}
